# This was largely copied from an example online (probably
# from the CMake mailing list)

# FFTW_INCLUDE_DIR = fftw3.h
# FFTW_LIBRARIES = libfftw3f.a
# FFTW_FOUND = true if FFTW3 is found

IF(FFTW_INCLUDE_DIRS)
  FIND_PATH(FFTW_INCLUDE_DIR fftw3.h  ${FFTW_INCLUDE_DIRS})
  FIND_LIBRARY(FFTW_LIBRARY fftw3f ${FFTW_LIBRARY_DIRS})
ELSE(FFTW_INCLUDE_DIRS)
  #  SET(TRIAL_PATHS
  #    $ENV{FFTW_HOME}/include
  #    /usr/include
  #    /usr/local/include
  #    /opt/include
  #    /usr/apps/include
  #  )
  #
  #  SET(TRIAL_LIBRARY_PATHS
  #    $ENV{FFTW_HOME}/lib
  #    /usr/lib 
  #    /usr/local/lib
  #    /opt/lib
  #    /sw/lib
  #    )
  #
  #  FIND_PATH(FFTW_INCLUDE_DIR fftw3.h ${TRIAL_PATHS})
  #  FIND_LIBRARY(FFTW_LIBRARY fftw3 ${TRIAL_LIBRARY_PATHS})
  FIND_PATH(FFTW_INCLUDE_DIR fftw3.h ${QMC_INCLUDE_PATHS})
  FIND_LIBRARY(FFTW_LIBRARIES fftw3f ${QMC_LIBRARY_PATHS}) 

ENDIF(FFTW_INCLUDE_DIRS)

SET(FFTW_FOUND FALSE)
IF(FFTW_INCLUDE_DIR AND FFTW_LIBRARIES)
  MESSAGE(STATUS "FFTW_INCLUDE_DIR=${FFTW_INCLUDE_DIR}")
  MESSAGE(STATUS "FFTW_LIBRARIES=${FFTW_LIBRARIES}")
  SET(FFTW_FOUND TRUE)
ENDIF()

MARK_AS_ADVANCED(
   FFTW_INCLUDE_DIR
   FFTW_LIBRARIES
   FFTW_FOUND
)
